package com.qdxwx.data.mapper.book;

import com.qdxwx.common.page.PageRequest;
import com.qdxwx.models.book.Book;
import com.qdxwx.models.book.BookQuery;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
/**
 * Qdx NetSchool Platform
 * @author qdxwx
 * @updateTime 2022/5/25
 * @description
 */
@Repository
public interface BookMapper {

    int insertBook(Book book);

    Book selectById(int id);

    List<Book> selectList(@Param("e") BookQuery book, @Param("page") PageRequest page);

    Integer selectCount(@Param("e") BookQuery booke);

    int updateBook(Book book);

    int deleteById(int id);

    //浏览数 +1
    int updateView(int id);

    //购买数 +1
    int updateBuy(int id);

    List<Book> selectListByTeacherId(@Param("teacherId") int teacherId, @Param("page") PageRequest page);

    int selectCountByTeacherId(@Param("teacherId") int teacherId);
}
